#include "SizePropertyWidget.h"
#include "ui_SizePropertyWidget.h"

SizePropertyWidget::SizePropertyWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SizePropertyWidget)
{
    ui->setupUi(this);

    init();
}

SizePropertyWidget::~SizePropertyWidget()
{
    delete ui;
}

unsigned short SizePropertyWidget::GetSize()
{
    return Size;
}

void SizePropertyWidget::init()
{
    on_Button_Size1_clicked();
}

void SizePropertyWidget::on_Button_Size1_clicked()
{
    Size = SIZES::SizeRate * 1;

    ui->Button_Size1->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize1_2.png);");
    ui->Button_Size2->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize2_1.png);");
    ui->Button_Size3->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize3_1.png);");
    ui->Button_Size4->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize4_1.png);");
    ui->Button_Size5->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize5_1.png);");

    emit SizeChange();
}

void SizePropertyWidget::on_Button_Size2_clicked()
{
    Size = SIZES::SizeRate * 2;

    ui->Button_Size1->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize1_1.png);");
    ui->Button_Size2->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize2_2.png);");
    ui->Button_Size3->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize3_1.png);");
    ui->Button_Size4->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize4_1.png);");
    ui->Button_Size5->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize5_1.png);");

    emit SizeChange();
}

void SizePropertyWidget::on_Button_Size3_clicked()
{
    Size = SIZES::SizeRate * 3;

    ui->Button_Size1->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize1_1.png);");
    ui->Button_Size2->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize2_1.png);");
    ui->Button_Size3->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize3_2.png);");
    ui->Button_Size4->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize4_1.png);");
    ui->Button_Size5->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize5_1.png);");

    emit SizeChange();
}

void SizePropertyWidget::on_Button_Size4_clicked()
{
    Size = SIZES::SizeRate * 4;

    ui->Button_Size1->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize1_1.png);");
    ui->Button_Size2->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize2_1.png);");
    ui->Button_Size3->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize3_1.png);");
    ui->Button_Size4->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize4_2.png);");
    ui->Button_Size5->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize5_1.png);");

    emit SizeChange();
}

void SizePropertyWidget::on_Button_Size5_clicked()
{
    Size = SIZES::SizeRate * 5;

    ui->Button_Size1->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize1_1.png);");
    ui->Button_Size2->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize2_1.png);");
    ui->Button_Size3->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize3_1.png);");
    ui->Button_Size4->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize4_1.png);");
    ui->Button_Size5->setStyleSheet("border-image: url(:/PenSize/Resource/PenSize5_2.png);");

    emit SizeChange();
}
